package com.ss.android.article.base.ui;

import android.content.Context;
import android.util.AttributeSet;

import com.ss.android.newmedia.webview.SSWebView;

public class ScrollListenerWebView extends SSWebView {
    public interface OnScrollChangeListener {
        void onScrollChanged(int scrollY);
    }

    private OnScrollChangeListener mOnScrollChangeListener;

    public ScrollListenerWebView(Context arg1) {
        super(arg1);
    }

    public ScrollListenerWebView(Context arg1, AttributeSet arg2) {
        super(arg1, arg2);
    }

    public ScrollListenerWebView(Context arg1, AttributeSet arg2, int arg3) {
        super(arg1, arg2, arg3);
    }

    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        try {
            super.onScrollChanged(l, t, oldl, oldt);
        } catch (Exception e) {
        }

        if (this.mOnScrollChangeListener != null) {
            this.mOnScrollChangeListener.onScrollChanged(this.getScrollY());
        }
    }

    public void setOnScrollChangeListener(OnScrollChangeListener listener) {
        this.mOnScrollChangeListener = listener;
    }
}

